<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String title = application.getServletContextName();
String theme = "metro";
%>
<!DOCTYPE html>
<html>
<head>
	<base href="<%=basePath%>">
	<title><%=title%></title>
	
	<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
	
	<link rel="stylesheet" type="text/css" href="<%=path%>/libs/themes/<%=theme%>/easyui.css">
	<link rel="stylesheet" type="text/css" href="<%=path%>/libs/themes/icon.css">
	<style type="text/css" title="currentStyle">
	html, body {
		width: 100%;
		height: 100%;
		margin: 0px;
		padding: 0px;
		overflow: hidden;
		font: 12px Verdana, sans-serif;
	}
	
	td.edit-form {
		width: 150px;
		height: 20px;
		min-height: 20px;
	}
	td.label-form {
		width: 100px;
		height: 20px;
		min-height: 20px;
	}
	
	</style> 
	
	<script src="<%=path%>/libs/jquery-1.9.1.js"></script>
	<script src="<%=path%>/libs/jquery.json-2.4.js"></script>
	<script src="<%=path%>/libs/jquery.easyui.min.js"></script>
	<script src="<%=path%>/libs/aciea.utils.js"></script>
	<script>
	$(document).ready(function() {
		$(window).resize(function() {
			autoResize();
		});
		$("#btnRegis").linkbutton({});
		$("#btnSignIn").linkbutton({});	
	});
	
	function autoResize() {}

	function signIn() {
		var url = "<%=path%>/auth";
		var params = $("#loginForm").serialize() + "&modulId=LX_USER&processId=userLogin";
		var result = executeAjaxSync(url, params);
		if (result != undefined) {
			var data = $.evalJSON(result);
			var userId = data.userId;
			if (userId.length > 0) {
				url = "<%=path%>/pages/desktop.jsp?userId="+userId;
				window.location.href = url;
				return true;
			}
		} else {
			//return false;
		}
	}
	function registration() {
		var url = "/genea/pages/user_register.jsp";
		$("#centerPanel").panel("refresh", url+"");
	}
	</script>
	
</head>
<body class="easyui-layout">
	<div id="topPanel" data-options="region:'north',border:false" style="height:60px; background-color:#ececec">
	</div>
	<div id="centerPanel" data-options="region:'center',border:false" style="padding: 0px;">
		<div style="text-align: center;; margin: 60px;">
			<img alt="" src="/genea/res/icons/family_tree_0001.jpg">
		</div>
	</div>
	<div id="rightPanel" data-options="region:'east',border:false" style="width: 300px;padding: 20px;">
		<form id="loginForm" action="<%=path%>/pages/desktop_main.jsp">
			<table>
				<tr><td colspan="2" class="label-form" style="text-align:center;">Příhlášení</td></tr>
				<tr>
					<td class="label-form">Uživatel</td>
					<td class="edit-form">
						<input type="input" name="userName" id="fldUserName" 
							class="easyui-textfiled" style="height: 20px; width: 150px;" value="jarda">
					</td>
				</tr>
				<tr>
					<td class="label-form">Heslo</td>
					<td class="edit-form">
						<input type="password" name="userPassword" id="fldUserPassword" 
							class="easyui-textfiled" style="height:20px; width: 150px;" value="j.Dyt68">
					</td>
				</tr>
				<tr>
					<td class="edit-form" style="padding-top: 10px;">
						<a id="btnRegis" href="javascript:registration();">Registrace</a>
					</td>
					<td class="edit-form" style="padding-top: 10px;"> 
						<a id="btnSignIn" href="javascript:signIn();">Přihlátit</a>
					</td>
				</tr>
				
			</table>
		</form>
	</div>
	<script type="text/javascript">
	//$("#mainPanel").layout({fit: true});
    </script>
	<%-- 
	<jsp:forward page="pages/desktop.jsp"></jsp:forward>
	--%>
</body>
</html>
